package com.usian.feign;

import com.usian.pojo.TbItem;
import com.usian.pojo.TbItemCat;
import com.usian.pojo.TbItemParam;
import com.usian.utils.PageResult;
import com.usian.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient("usian-item-service")
@RequestMapping("/service")
public interface ItemFeign {
    @RequestMapping("/item/selectItemInfo")
    public TbItem selectItemInfo(@RequestParam("itemId")Long itemId);


    @RequestMapping("/item/selectTbItemAllByPage")
    public PageResult selectTbItemAllByPage(@RequestParam(value = "page",defaultValue = "1") String page, @RequestParam(value = "rows",defaultValue = "2") String rows);

    @RequestMapping("/itemCategory/selectItemCategoryByParentId")
    List<TbItemCat> selectItemCategoryByParentId(@RequestParam(value = "id") Integer id);

    @RequestMapping("/itemParam/selectItemParamByItemCatId/{itemCatId}")
    public TbItemParam selectItemParamByItemCatId(@PathVariable("itemCatId") Integer itemCatId);

    @PostMapping("/item/insertTbItem")
    Integer insertTbItem(@RequestBody TbItem tbItem,@RequestParam("desc") String desc,@RequestParam("itemParams") String itemParams);

    @RequestMapping("/item/preUpdateItem")
    Map<String, Object> preUpdateItem(@RequestParam("itemId") Long itemId);

    @RequestMapping("/item/deleteItemById")
    Integer deleteItemById(@RequestParam("itemId") Long itemId);

    @RequestMapping("/item/updateTbItem")
    Integer updateTbItem(TbItem tbItem,@RequestParam("desc") String desc,@RequestParam("itemParams") String itemParams);

}
